Type Map<T>
Namespace Karcero.Engine.Models
A matrix of cells.
Methods
- GetAdjacentCell
- GetAllAdjacentCells
- GetAllAdjacentCellsByDirection
- GetCell
- GetCellsAdjacentToRoom
- GetRoomCells
- IsLocationInRoom
- TryGetAdjacentCell
Properties
Public instance methods
T GetAdjacentCell(T cell, Direction direction, int distance)
IEnumerable<T> GetAllAdjacentCells(T cell, bool includeDiagonalCells)
Dictionary<Direction, T> GetAllAdjacentCellsByDirection(T cell)
T GetCell(int row, int column)
Returns the cell in a specified location.
Parameters
-
int
row - The row of the desired cell.
-
int
column - The column of the desired cell.
Returns
-
T
- The desired cell if exists, null otherwise.
IEnumerable<T> GetCellsAdjacentToRoom(Room room, int distance)
Get the cells adjacent to all of the edges of the room specified in a certain distance.
Parameters
-
Room
room - The desired room.
-
int
distance - The desired distance (defaults to 1).
Returns
-
IEnumerable<T>
- A collection of all of the cells adjacent to all of the edges of the room specified in the desired distance.
IEnumerable<T> GetRoomCells(Room room)
Get the cells the specified room is comprised of.
Parameters
-
Room
room - The desired room.
Returns
-
IEnumerable<T>
- The cells the specified room is comprised of.
bool IsLocationInRoom(int row, int column)
Returns true if a cell location is inside any room on the map.
Parameters
-
int
row - The desired row.
-
int
column - The desired column.
Returns
-
bool
- True if the specified location is in any room on the map.
bool TryGetAdjacentCell(T cell, Direction direction, T& adjacentCell)
Public properties
IEnumerable<T> AllCells get;
A collection of all of the cells in the map generated with a LINQ operation (order not guaranteed).
int Height get; set;
The height of the map.
List<Room> Rooms get; set;
A collection of rooms that the are contained in the map.
int Width get; set;
The width of the map.